from PIL import Image

imageName = 'pea_grow'
gif = Image.open("/Users/wilson/Desktop/peaShooter_grew.gif")
dirName = 'plants/pea/grow'
try:
    frame_index = 0
    while True:
        gif.save(f"plants/image/{dirName}/{imageName}_{frame_index}.png")
        frame_index += 1
        gif.seek(frame_index)  # 跳到下一帧
except EOFError:  # 帧读取完毕
    pass
